package org.crh.sms;

import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.crh.common.domain.AppointmentRecord;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @description:
 * @author: RenHai Chen
 * @date: 2025/3/31 10:40
 */
// 支付成功通知
@Service
@RocketMQMessageListener(nameServer = "${spring.rocketmq.name-server}", topic = "PAY_SUCCESS_TOPIC", consumerGroup = "sms_pay_group")
public class PaySuccessSmsListener implements RocketMQListener<AppointmentRecord> {
    @Autowired
    SmsService smsService;

    public void onMessage(AppointmentRecord order) {
        smsService.sendSms(order.getPhone(),
                "预约成功！订单号：" + order.getAppointmentId());
    }

}

